package com.syni.mdd.sjb.community.base.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.task.TaskExecutor;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

/**
 * @className TaskExecutorConfig
 * @description TOO
 * @Author cfx
 * @DATE 2019/8/13 16:59
 * @VERSION 1.0
 **/
@Configuration
@EnableAsync
public class TaskExecutorConfig {
    /***
     * 创建异步任务执行线程池
     * @return
     */
    @Bean("taskExecutor")
    public TaskExecutor getAsyncExecutor() {
        ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
        taskExecutor.initialize();
        return taskExecutor;
    }
}
